package com.example.manager.controller;

import com.example.manager.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("web")
public class WebController {

    @RequestMapping("toindex")
    public String toindex(String admin, Model model, HttpSession session){
        User user = (User) session.getAttribute("user");
        if (user.getAdmin()==0){
            return "index";
        }else {
            model.addAttribute("admin",admin);
            return "index";
        }

    }
    @RequestMapping("toaddbook")
    public String toaddbook(Model model){
        return "addbook";

    }


    @RequestMapping("toupdatepw")
    public String toupdatepw(){
        return "updatepw";
    }

    @RequestMapping("tofollowlist")
    public String tofollowlist(){
        return "showfollow";
    }


}
